#include "PTLock.h"

#include <stdio.h>
#include <string.h>

// #include "interface.h"

volatile unsigned long head = 0;
volatile unsigned long tail = 0;
volatile unsigned long waitq[NT] = {0};
volatile int g_old_index = 0;

void init_ptlock()
{
    int i;
    size = NT;
#ifdef ORDER
    head = size;
    tail = size + 1;
#endif

    for (i = 0; i < size; i++) {
#ifdef ORDER
        waitq[i] = size;
#else
        waitq[i] = 0;
#endif
        destq[i] = -1;
        // if(waitq[i]-destq[i]>0)
        printf("waitq[%d]=%lu,%d\t", i, waitq[i], destq[i]);
    }
}